home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / tde40.zip / tdecfg.h < prev    next >
C/C++ Source or Header  |  1994-06-05  |  18KB  |  543 lines

  1. /*
  2.  * the config utility now finds the offsets for the editor structures.
  3.  */
  4.  
  5. /*
  6.  * defines for the inline assembler.
  7.  */
  8. #if defined( __MSC__ )
  9.    #define  ASSEMBLE   _asm
  10. #else
  11.    #define  ASSEMBLE   asm
  12. #endif
  13.  
  14.  
  15. #define TRUE            1
  16. #define FALSE           0
  17.  
  18. #define OK              0
  19. #define ERROR           (-1)
  20.  
  21.  
  22. #define MAX_KEYS        256
  23. #define AVAIL_KEYS      233
  24.  
  25.  
  26. #define MAX_TWO_KEYS    128   /* number of two key-combos allowed by TDE  */
  27. #define STROKE_LIMIT    1024
  28.  
  29.  
  30. #define NUM_FUNCS       143
  31.  
  32. #define NUM_COLORS      14
  33.  
  34. #define NUM_MODES       23
  35.  
  36.  
  37.  
  38. #define EXIST           0
  39.  
  40. #define VIDEO_INT       0x10
  41.  
  42. #define VGA             3
  43. #define EGA             2
  44. #define CGA             1
  45. #define MDA             0
  46.  
  47. #define NORMAL          7
  48. #define COLOR_ATTR      31
  49. #define MONO_ATTR       112
  50.  
  51.  
  52. #define ESC             27
  53. #define LEFT            (75 | 0x100)
  54. #define RIGHT           (77 | 0x100)
  55. #define UP              (72 | 0x100)
  56. #define DOWN            (80 | 0x100)
  57. #define RTURN           13
  58. #define PGUP            (73 | 0x100)
  59. #define PGDN            (81 | 0x100)
  60. #define F1              (59 | 0x100)
  61. #define F2              (60 | 0x100)
  62. #define F3              (61 | 0x100)
  63. #define F5              (63 | 0x100)
  64. #define F6              (64 | 0x100)
  65. #define F7              (65 | 0x100)
  66. #define F8              (66 | 0x100)
  67. #define F10             (68 | 0x100)
  68.  
  69.  
  70. #define U_LEFT          218
  71. #define U_RIGHT         191
  72. #define VER_LINE        179
  73. #define HOR_LINE        196
  74. #define L_LEFT          192
  75. #define L_RIGHT         217
  76.  
  77. #define SAVE            0
  78. #define RESTORE         1
  79.  
  80.  
  81. #ifndef MY_TYPES
  82. #define MY_TYPES
  83.  
  84. /*
  85.  * mode indexes
  86.  */
  87. #define Ins              0
  88. #define Ind              1
  89. #define PTAB             2
  90. #define LTAB             3
  91. #define Smart            4
  92. #define Write_Z          5
  93. #define Crlf             6
  94. #define Trim             7
  95. #define Eol              8
  96. #define WW               9
  97. #define Left            10
  98. #define Para            11
  99. #define Right           12
  100. #define Size            13
  101. #define Backup          14
  102. #define Ruler           15
  103. #define Date            16
  104. #define Time            17
  105. #define Initcase        18
  106. #define InflateTabs     19
  107. #define Match           20
  108. #define Ignore          21
  109. #define JustRM          22
  110.  
  111. /*
  112.  * structure for list of available keys.   See default.h for more info.
  113.  */
  114. typedef struct {
  115.    char *key;           /* key name */
  116.    int  key_index;      /* offset into key structure in tde.exe file */
  117. } CONFIG_DEFS;
  118.  
  119. #endif
  120.  
  121.  
  122. /*
  123.  * Save the underlying text of the screen in a structure.  We need to know
  124.  * the column and row to begin saving the text.  Since we are doing an
  125.  * optimal save and restore, we don't know how much memory to allocate to
  126.  * the save buffer.  If we use a pointer, then we can dynamically allocate as
  127.  * much or as little memory as we need.  Finally, we need a window pointer
  128.  * to point to the next item on the stack.
  129.  */
  130. typedef struct win {
  131.    int x;
  132.    int y;
  133.    int *buf;
  134.    struct win *n;
  135. } WINDOW;
  136.  
  137.  
  138. /*
  139.  * Structure to store the row and column of a string.
  140.  */
  141. struct screen {
  142.    unsigned int   row;
  143.    unsigned int   col;
  144.    unsigned char *text;
  145. };
  146.  
  147.  
  148. /*
  149.  * video adapter stuff.
  150.  */
  151. struct vcfg {
  152.    int color;
  153.    int rescan;
  154.    int mode;
  155.    int overscan;
  156.    int adapter;
  157.    int attr;
  158.    int far *videomem;
  159. };
  160.  
  161.  
  162. typedef struct {
  163.    char sig[8];                 /* signature, so we can find struct in .exe */
  164.    int  clr[2][NUM_COLORS];     /* one array for mono and another for color */
  165. } COLORS;
  166.  
  167.  
  168. /*
  169.  * When we display a pop-up or pull-down window, we need to know a few things
  170.  * about the window and the text to display in the window.
  171.  */
  172. typedef struct {
  173.    int dply_col;        /* offset into window to begin displaying help list */
  174.    int dply_row;        /* dito */
  175.    int line_length;     /* the length of the help line in the window */
  176.    int avail_lines;     /* number of lines in the window available for list */
  177.    int v_row;           /* virtual row of cursor in window */
  178.    int select;          /* item currently selected in help list */
  179.    int num_entries;     /* total number of items in help list */
  180.    int ulft_col;        /* absolute upper left column of window */
  181.    int ulft_row;        /* absolute upper left row of window */
  182.    int total_col;       /* total number of columns in window */
  183.    int total_row;       /* total number of rows in window */
  184. } HELP_WINDOW;
  185.  
  186.  
  187. /*
  188.  * structure for list of available keys.   See default.h for more info.
  189.  */
  190. typedef struct {
  191.    char *key;           /* key name */
  192.    int  key_index;      /* offset into key structure in tde.exe file */
  193.    unsigned char func_index;     /* function of key */
  194. } KEY_DEFS;
  195.  
  196.  
  197. /*
  198.  * From the source code of tde.
  199.  */
  200. typedef struct {
  201.   int key;      /* key assinged to this node, which may be text or function */
  202.   int next;     /* pointer to next node in macro def */
  203. } STROKES;
  204.  
  205. /*
  206.  * structure for the macro buffer.
  207.  */
  208. typedef struct {
  209.    char sig[8];                         /* signature, easy to find in .exe */
  210.    int  first_stroke[MAX_KEYS];         /* pointer to first key in macro */
  211.    STROKES strokes[STROKE_LIMIT];       /* buffer to hold key strokes */
  212. } MACRO;
  213.  
  214.  
  215.  
  216. /*
  217.  * "mode_infos" contain the editor mode variables.  The configuration
  218.  *  utility modifies this structure to custimize the start-up tde
  219.  *  configuration
  220.  */
  221. typedef struct {
  222.    char sig[8];                 /* signature, so we can find struct in .exe */
  223.    int  color_scheme;           /* color to start out with */
  224.    int  sync;                   /* sync the cursor movement command? */
  225.    int  sync_sem;               /* sync the cursor movement command? */
  226.    int  record;                 /* are we recording keystrokes? */
  227.    int  insert;                 /* in insert mode? */
  228.    int  indent;                 /* in auto-indent mode? */
  229.    int  ptab_size;              /* physical tab stops */
  230.    int  ltab_size;              /* logical tab stops */
  231.    int  smart_tab;              /* smart tab mode on or off? */
  232.    int  inflate_tabs;           /* inflate tabs?  T or F */
  233.    int  search_case;            /* consider case? IGNORE or MATCH */
  234.    int  enh_kbd;                /* type of keyboard */
  235.    int  cursor_size;            /* insert cursor big or small? */
  236.    char *eof;                   /* message to display at end of file */
  237.    int  control_z;              /* write ^Z - t or f */
  238.    int  crlf;                   /* <cr><lf> toggle CRLF or LF */
  239.    int  trailing;               /* remove trailing space? T or F */
  240.    int  show_eol;               /* show lf at eol? T or F */
  241.    int  word_wrap;              /* in word wrap mode? */
  242.    int  left_margin;            /* left margin */
  243.    int  parg_margin;            /* column for 1st word in paragraph */
  244.    int  right_margin;           /* right margin */
  245.    int  right_justify;          /* boolean, justify right margin?  T or F */
  246.    int  format_sem;             /* format semaphore */
  247.    int  undo_max;               /* max number of lines in undo stack */
  248.    int  do_backups;             /* create backup or ".bak" files? T or F */
  249.    int  ruler;                  /* show ruler at top of window? T or F */
  250.    int  date_style;             /* date style for date and time stamp */
  251.    int  time_style;             /* time style for date and time stamp */
  252. } MODE_INFO;
  253.  
  254.  
  255. typedef struct {
  256.    unsigned char ignore[256];
  257.    unsigned char match[256];
  258. } SORT_ORDER;
  259.  
  260.  
  261. /*
  262.  * structure for two key combos
  263.  */
  264. typedef struct {
  265.    int parent_key;
  266.    int child_key;
  267.    int func;
  268. } TWO_KEY_TYPE;
  269.  
  270.  
  271. typedef struct {
  272.    char sig[8];
  273.    TWO_KEY_TYPE key[MAX_TWO_KEYS];
  274. } TWO_KEY;
  275.  
  276.  
  277. typedef struct {
  278.    char sig[8];
  279.    unsigned char key[MAX_KEYS];
  280. } KEY_FUNC;
  281.  
  282.  
  283.  
  284.  
  285. /*************  prototypes for functions in  tdecfg.c  *******************/
  286. void main( int, char *[] );
  287. void build_next_table( char *, char * );
  288. int  find_offsets( char * );
  289. void xy